﻿Imports System.Net
Imports System.IO
Imports System.Text.RegularExpressions

Public Class NetLogicBuss

    Public Shared Function GetIpAdress(ByVal URL As String) As String

        Try

            Dim client As New WebClient()

            ' Add a user agent header in case the requested URI contains a query.
            client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR1.0.3705;)")

            Dim dataStream As Stream = client.OpenRead(URL)
            Dim reader As New StreamReader(dataStream)
            Dim Response As String = reader.ReadToEnd()
            dataStream.Close()
            reader.Close()
            Dim strIP As String = (New Regex("\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b")).Match(Response).Value

            Return strIP

        Catch ex As Exception



        End Try

        Return ""

    End Function


End Class
